package com.undsf.cpudb.entities

import com.fasterxml.jackson.annotation.JsonProperty

import java.text.SimpleDateFormat

class CpuInfo {
    @JsonProperty
    int id

    @JsonProperty
    String name

    @JsonProperty
    String socket

    String clockSpeedStr

    //@JsonProperty("turbo_speed")
    String turboSpeedStr

    // @JsonProperty
    String coresStr

    // @JsonProperty("typical_tdp")
    String typicalTDPStr

    // @JsonProperty("other_name")
    // String otherName

    @JsonProperty("clock_speed")
    double clockSpeed

    @JsonProperty("turbo_speed")
    double turboSpeed

    @JsonProperty("physics_cores")
    int physicsCores

    @JsonProperty("logical_cores")
    int logicalCores

    @JsonProperty("release_date")
    Date releaseDate

    // @JsonProperty("typical_tdp")
    double typicalTDP

    @JsonProperty
    double price

    @JsonProperty
    int mark

    @JsonProperty("thread_rating")
    double threadRating

    def parse() {

    }

    String toString() {
        return id + ": " + name + "  # " + mark
    }

    String toCSV() {
        return id + "\t" +
                name + "\t" +
                socket + "\t" +
                clockSpeedStr + "\t" +
                turboSpeedStr + "\t" +
                coresStr + "\t" +
                typicalTDPStr + "\t" +
                releaseDate.format("yyyy-mm-dd") + "\t" +
                price + "\t" +
                threadRating + "\t" +
                mark
    }
}
